<button class="button mobile" id="mobileDocsNavToggle" aria-expanded="false" aria-controls="docsNav">Table of contents</button>
<noscript>Please enable javascript to use dropdown navigation</noscript>
<div class="side-nav" id="docsNav">
    {{ if .Site.Params.use_advanced_docs }}
        <noscript>Please enable javascript to use dropdown navigation</noscript>
        {{ $version       := index (split .File.Path "/") 1 }}
        {{ .Render "versions" }}
        {{ .Render "search" }}
        {{ if $version }}
            {{ $tocTemplateName := index (index $.Site.Data.docs "toc-mapping") $version }}
            {{ if not $tocTemplateName }}
                {{ $tocTemplateName = "default" }}
            {{ end }}
            {{ $toc := (index $.Site.Data "docs" $tocTemplateName).toc }}
            {{ range $toc }}
                <button class="h4 collapse-trigger" aria-expanded="false">{{ .title }}</button>
                <ul class="collapse">
                    {{ range .subfolderitems }}
                    <li>
                        {{ if .package }}
                        {{ $pkg := .package }}
                            <h5 class="collapse-trigger" aria-expanded="false">{{ $pkg.displayName }}</h5>
                            <ul class="collapse">
                                {{ range $ver := .package.versions }}
                                    <li>
                                        {{ $suburl := (index (print "/docs/" $version "/package-readme-" $pkg.name "-" $ver "/")) }}
                                        <a href="{{ $suburl }}" class="{{ if (eq  $.Page.RelPermalink $suburl)  }}active{{ end }}">{{ $ver }}</a>
                                    </li>
                                {{ end }}
                            </ul>
                        {{ else }}
                            {{ $url :=  (index (print "/docs/" $version .url "/"))  }}
                            <a href="{{ $url }}" class="{{ if (eq  $.Page.RelPermalink $url)  }}active{{ end }}">{{ .page }}</a>
                            {{ if .subitems }}
                            <ul>
                                {{ range .subitems }}
                                <li>
                                    {{ $suburl := (index (print "/docs/" $version .suburl "/")) }}
                                    <a href="{{ $suburl }}" class="{{ if (eq  $.Page.RelPermalink $suburl)  }}active{{ end }}">{{ .subpage }}</a>
                                </li>
                                {{ end }}
                            </ul>
                            {{ end }}
                        {{ end }}
                    </li>
                    {{ end }}
                </ul>
            {{ end }}
        {{ end }}
    {{ else }}
        <ul>
            {{ $currentPage := . }}
            {{ range .Site.Menus.docs }}
                <li><a href="{{ .URL }}" {{ if (eq $currentPage.RelPermalink .URL)  }}class="active"{{ end }}>{{ .Name }}</a></li>
            {{ end }}
        </ul>
    {{ end }}
</div>